package com.example.mall.order.domain.vo;

import com.example.mall.common.handler.ArrayTypeHandler;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.stereotype.Component;

import java.math.BigDecimal;
import java.util.List;

/**
 * 费用项
 *
 * @author Mickey
 * @since 2022/4/22
 **/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class FeeItem {

    private Integer type;
    private BigDecimal fee;

    @Component
    public static class FeeItemArrayType extends ArrayTypeHandler<FeeItem> {
        public FeeItemArrayType(ObjectMapper objectMapper) {
            super(objectMapper);
        }

        @Override
        public TypeReference<List<FeeItem>> getType() {
            return new TypeReference<List<FeeItem>>() {
            };
        }
    }
}
